export default function ({ $axios, redirect, store, app, route }) {
  $axios.onResponse((res) => {
  })

  $axios.onError((error) => {
    const code = parseInt(error.response && error.response.status)
    switch (code) {
      case 404:
        redirect('/sorry')
        break
      case 401:
        store.commit('removeUserDataMutation')
        if (route.name === 'edit-id') {
          redirect('/')
        }
        app.$alert('请登录！', '提示', {
          confirmButtonText: '确定',
          type: 'warning',
          lockScroll: false,
          callback: () => {
            // redirect('/')
          }
        })
        break
    }
  })
}
